<script type="text/javascript">
	function StuInfoCtrl($rootScope, modalService, $http) {
		var ctrl = this;
		this.view = function () {
			var param = {
				title: '个人信息',
				contentUrl: ':root/components/student/info.html',
				search: {
					enable: false,
					user: $rootScope.$signUpInfo.user
				},
				editable: false,
				result: $rootScope.$signUpInfo,
				ctrl: ctrl
			}
			return modalService.show(param)
		}
		this.edit = function () {
			var param = {
				title: '修改个人信息',
				contentUrl: ':root/components/student/info.html',
				search: {
					enable: false,
					user: $rootScope.$signUpInfo.user
				},
				editable: true,
				result: $rootScope.$signUpInfo,
				ctrl: ctrl
			}
			return modalService.confirm(param, {
				backdrop: false
			}).then(function (r) {
				$http.post(':root/trainee/updateMyInfo', r).success(function (r) {
					modalService.succ('修改成功', 1500)
					$rootScope.$signUpInfo = r
				})
			})
		}
	}

</script>

<div class="container main">
	<div class="row media">
		<!-- left menu -->
		<div class="col-md-2">
			<div class="thumbnail" ng-controller="StuInfoCtrl as ctrl">
				<img ng-src="{{toUrl('root/asset/images/touxiang.png')}}" alt="...">
				<div class="caption carousel-inner">
					<h3>{{$user.name}}</h3>
					<p>
						<small class="text-muted">{{$user.uid}}</small>
					</p>
					<div>
						<a href="javascript:;" ng-click="ctrl.view()">个人信息</a>
						<a href="javascript:;" ng-click="ctrl.edit()">修改</a>
					</div>
				</div>
			</div>
			<data entity="StuInfo" auto-load="true" page="false" after-refresh="stuInfos=(data)">
				<filter field="user.id" value="$user.id"></filter>
			</data>
			<div class="row">
				<div class="text-left col-xs-12 btn-group-vertical" role="group">
					<a  ng-show="stuInfos.length>0" ng-class="{true:'btn-cys',false:'btn-default'}[$state.current.name=='student.home']" type=" button" ui-sref="student.home" class="btn btn-lg btn-block">
						<span class="glyphicon glyphicon-home"></span>
						首页
					</a>
					<a  ng-show="stuInfos.length>0" ng-class="{true:'btn-cys',false:'btn-default'}[$state.current.name=='student.course']" type=" button" ui-sref="student.course" class="btn btn-lg btn-block">
						<span class="glyphicon glyphicon-book"></span>
						我的课程
					</a>
					<a  ng-show="stuInfos.length>0" ng-class="{true:'btn-cys',false:'btn-default'}[$state.current.name=='student.score']" type=" button" ui-sref="student.score" class="btn btn-lg btn-block">
						<span class="glyphicon glyphicon-education"></span>
						我的成绩
					</a>
					<a  ng-show="stuInfos.length>0" ng-class="{true:'btn-cys',false:'btn-default'}[$state.current.name=='student.attendance']" type=" button" ui-sref="student.attendance" class="btn btn-lg btn-block">
						<span class="glyphicon glyphicon-bell"></span>
						考勤|请假
					</a>
					<a  ng-show="stuInfos.length>0" ng-class="{true:'btn-cys',false:'btn-default'}[$state.current.name=='student.message']" type=" button" ui-sref="student.message" class="btn btn-lg btn-block">
						<span class="glyphicon glyphicon-comment"></span>
						消息通知
					</a>
					<a type="button" ui-sref="student.signUp" class="btn btn-default btn-lg btn-block" ui-sref-active="btn-cys">
						<span class="glyphicon glyphicon-th-list"></span>
						报名
					</a>

				</div>


			</div>
		</div>
		<!-- left menu END -->

		<!-- main area -->
		<div class="col-md-10" ui-view></div>
		<!-- main area END-->
	</div>
</div>